<!--
 * @Description: 相关课程组件
 * @Version: 2.0
 * @Autor: Seven
 * @Date: 2020-12-01 18:00:31
 * @LastEditors: Seven
 * @LastEditTime: 2020-12-22 17:11:55
-->
<template>
    <bar title="相关课程">
        <div class="list" v-if="data.length !== 0">
            <nuxt-link
                :to="_url(item.onlineType, item.id)"
                class="item"
                v-for="(item, index) in data"
                :key="index"
                v-if="index < 5"
            >
                <div class="img-box">
                    <img :src="IMG_URL + item.img" alt="item.name" />
                </div>
                <div class="info-box">
                    <div class="name">{{ item.title }}</div>
                    <div class="info">{{ item.des }}</div>
                    <div class="Price">{{ item.price }}</div>
                </div>
            </nuxt-link>
        </div>
    </bar>
</template>
<script>
import course_mixin from './course_mixin';
export default {
    mixins: [course_mixin],
    props: {
        data: {
            type: Array,
            default: () => {
                return [];
            },
        },
    },
};
</script>
<style lang="scss" scoped>
.list {
    .item {
        display: flex;
        .img-box {
            flex: 0 0 120px;
            height: 80px;
            overflow: hidden;
            img {
                width: 100%;
            }
        }
        & + .item {
            margin-top: 14px;
        }
        .info-box {
            padding-left: 10px;
            .name {
                font-size: 14px;
                color: #333333;
                @include line-over(1);
            }
            .info {
                font-size: 12px;
                color: #999999;
                margin-top: 10px;
                @include line-over(1);
            }
            .Price {
                font-size: 16px;
                color: #f93e3e;
                font-weight: bold;
                margin-top: 15px;
            }
        }
    }
}
</style>